package com.tencent.sr.iris.basic.saas.common.enums;

import java.util.Objects;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author nixiaolin
 * @date 2022/9/23 14:09
 */
@Getter
@AllArgsConstructor
public enum YesOrNoEnum {

    NO(0, "否"),

    YES(1, "是");

    private final int value;

    private final String desc;

    public byte toByte() {
        return (byte) value;
    }

    public static String getByValue(Integer value) {
        for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
            if (Objects.equals(yesOrNoEnum.getValue(), value)) {
                return yesOrNoEnum.getDesc();
            }
        }
        return "";
    }
}
